#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
#define N 100010
int n;
int q[N];
int t[N];
long long num = 0;
void merge_sort(int q[], int l, int r)
{
    if (l >= r) return;
    int mid = l + r >> 1;
    merge_sort(q, l, mid);
    merge_sort(q, mid + 1, r);
    int i = l, j = mid + 1, k = 0;
    while (i <= mid && j <= r)
    {
        if (q[i] <= q[j])
            t[k++] = q[i++];
        else
        {
            t[k++] = q[j++];
            num+=mid-i+1;
        }
    }
    while (i <= mid) { t[k++] = q[i++]; }
    while (j <= r) t[k++] = q[j++];
    for (i = 0, j = l; j <= r; i++, j++)
        q[j] = t[i];
}
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d", &q[i]);
    merge_sort(q, 0, n - 1);
    printf("%lld\n", num);
    return 0;
}